load("@rules_proto//proto:defs.bzl", "proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
    name = "livenesspb",
    srcs = [
        "liveness.go",
        "liveness_test_helper.go",
    ],
    embed = [":livenesspb_go_proto"],
    importpath = "github.com/cockroachdb/cockroach/pkg/kv/kvserver/liveness/livenesspb",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/roachpb",
        "//pkg/util/hlc",
        "//pkg/util/timeutil",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_cockroachdb_redact//:redact",
        "@org_golang_google_grpc//codes",
        "@org_golang_google_grpc//status",
    ],
)

proto_library(
    name = "livenesspb_proto",
    srcs = ["liveness.proto"],
    strip_import_prefix = "/pkg",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/util/hlc:hlc_proto",
        "@com_github_gogo_protobuf//gogoproto:gogo_proto",
    ],
)

go_proto_library(
    name = "livenesspb_go_proto",
    compilers = ["//pkg/cmd/protoc-gen-gogoroach:protoc-gen-gogoroach_compiler"],
    importpath = "github.com/cockroachdb/cockroach/pkg/kv/kvserver/liveness/livenesspb",
    proto = ":livenesspb_proto",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/roachpb",  # keep
        "//pkg/util/hlc",
        "@com_github_gogo_protobuf//gogoproto",
    ],
)
